<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Insert title here</title>
		<link rel="stylesheet" href="/wk2un10/houtai/lib/layui/css/layui.css">
	</head>

	<body>
		<form class="layui-form" action="">
			<div class="layui-container">  
			<div class="layui-row">
			 <div class="layui-col-md4">
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">公司介绍</label>
				<div class="layui-input-block">
					<textarea name="homeInfo" id="homeInfo" placeholder="请输入内容" class="layui-textarea" lay-verify="content">
					${h.homeInfo}
					</textarea>
				</div>
			</div>
			</div>
			
			 <div class="layui-col-md4">
			<div class="layui-form-item layui-form-text">
				<label class="layui-form-label">公司文化</label>
				<div class="layui-input-block">
					<textarea name="info" id="info" placeholder="请输入内容" class="layui-textarea" lay-verify="content">
					${h.info}
					</textarea>
				</div>
			</div>
			</div>
			
			
			 <div class="layui-col-md4">
			<div class="layui-form-item layui-form-text ">
				<label class="layui-form-label">详细介绍</label>
				<div class="layui-input-block">
					<textarea name="culture" id="culture" placeholder="请输入内容" class="layui-textarea" lay-verify="content">
					${h.culture}
					</textarea>
				</div>
			</div>
			</div>
			</div>
			 <div class="layui-col-md12">
			<div class="layui-form-item">
				<label class="layui-form-label">招商电话</label>
				<div class="layui-input-block">
					<input type="text" name="zsTel" value="${h.zsTel}" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			</div>
			<div class="layui-row">
			 <div class="layui-col-md12">
			<div class="layui-form-item">
				<label class="layui-form-label">联系电话</label>
				<div class="layui-input-block">
					<input type="text" name="lxTel" value="${h.lxTel}" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			</div>
			</div>
			<div class="layui-row">
			 <div class="layui-col-md12">
			<div class="layui-form-item">
				<label class="layui-form-label">邮箱</label>
				<div class="layui-input-block">
					<input type="text" name="email" value="${h.email}" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			</div>
			</div>
			<div class="layui-row">
			 <div class="layui-col-md12">
			<div class="layui-form-item">
				<label class="layui-form-label">地址</label>
				<div class="layui-input-block">
					<input type="text" name="address"  value="${h.address}" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			</div>
			</div>
			<div class="layui-row">
			 <div class="layui-col-md12">
			<div class="layui-form-item">
				<label class="layui-form-label">x</label>
				<div class="layui-input-block">
					<input type="text" name="x"  value="${h.x}" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			</div>
			</div>
			<div class="layui-row">
			 <div class="layui-col-md12">
			<div class="layui-form-item">
				<label class="layui-form-label">y</label>
				<div class="layui-input-block">
					<input type="text" name="y"  value="${h.y}" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
				</div>
			</div>
			</div>
			</div>
			<div class="layui-row">
			 <div class="layui-col-md12">
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
			</div>
			</div>
			</div>
		</form>
	<script type="text/javascript" src="/wk2un10/houtai/lib/layui/layui.js"></script>
		<script>
			//Demo
			layui.use(['form','layedit'], function() {
				var form = layui.form;
				var $ = layui.jquery; //引入jquery
				var layedit=layui.layedit;
				var index = layedit.build('homeInfo');
				var ind = layedit.build('info');
				var ins = layedit.build('culture');
				//监听提交
				form.verify({
					content:function(value){
						return layedit.sync(index,ind,ins);
						
						
					}
				});
				form.on('submit(formDemo)', function(data) {
					var d = data.field; //表单中的数据，定义一个对象来接收
					//通过ajax向数据库提交数据了
					d.method="update";
					console.log(d); //提交之前的一个数据验证、通过打印的方式先手动的去判断一下这个数据
					var url ='/wk2un10/HouHomeInfoServlet';//地址不对
					//确保数据没有问题就进行ajax提交了
					$.post(url, d,
						function(data) {
							if(data.count>0){//对应Result里面的count
								console.log('修改成功');
								layer.msg('修改成功'); 
							}
						}, "json");
					return false;
				});
			});
		</script>
	</body>

</html>